package com.os.ch2.profile;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;

/**
 * @Author Matt
 * @Date 2022-01-11
 * @Desc: 配置类
 * @Version V1.0
 */
@Configuration
public class ProfileConfig {

    @Bean
    @Profile("dev")  //profile为dev时实例化的bean
    public DemoBean devDemoBean(){
        return new DemoBean("from development profile");
    }

    @Bean
    @Profile("prod")  //profile为prod时实例化的bean
    public DemoBean prodDemoBean(){
        return new DemoBean("from production profile");
    }
}
